<meta charset="utf-8"/>
<div class="row">
  <div class="col-xs-12">
    <div class="row">
      <div class="col-xs-12">
        <div class="clearfix" style="height:42px;">
          <table class="no-border" style="display:inline">
            <tr>
              <td permission='orderLog_btn_listData' style="padding: 0px 6px;display:none">
                订单号
              </td>
              <td permission='orderLog_btn_listData' style="display:none">
                <div class="input-group">
                  <input type="text" id="key_out_trade_no" class="form-control search-query" placeholder="订单号" style="width:160px"/>
                </div>
              </td>
              <td permission='orderLog_btn_listData' class="hidden-480" style="padding: 0px 6px;display:none">
                下单时间
              </td>
              <td permission='orderLog_btn_listData' style="display:none">
                <div class="input-group">
                  <input type="text" id="key_add_time" class="form-control search-query hidden-480" placeholder="下单时间" style="width:90px"/>
                  <span class="input-group-btn">
                    <button type="button" class="btn btn-inverse btn-white" id="btnSearch">
                      <span class="ace-icon fa fa-search bigger-110"></span>
                      搜索
                    </button>
                  </span>
                </div>
              </td>
            </tr>
          </table>
          <div class="hidden-480 pull-right tableTools-container" permission='orderLog_btn_listData' style="display:none"></div>
        </div>
        <table id="tableListOrderLog" class="table table-striped table-bordered table-hover"></table>
      </div>
    </div>
  </div>
</div>
<div id="divKeyColumns" style="display:none;padding:1px 0px;"></div>
<div style="display:none;">
  <input type="hidden" id="orderLog_btn_listData"/>
  <input type="hidden" id="orderLog_row_queryById"/>
</div>
<script type="text/javascript">
  var scripts = [null, null];
  $('.page-content-area').ace_ajax('loadScripts', scripts, function(){
    var tableDom = '#tableListOrderLog';
    $(function(){
      var urlRoute = '/orderLog/';/*请求controller层的url*/
      var getList = urlRoute + 'listData';/*获取数据列表*/
      var thisTable = pageDataTable.initDataTable({
        tableDom : tableDom,
        sAjaxSource : getList,
        fnServerParams : function(params){
          params.push(
            {"name":"out_trade_no","value":$("#key_out_trade_no").val()},
            {"name":"add_time","value":$("#key_add_time").val()}
          );
        },
        aoColumns : [
          {
            mData : "creator",
            bSortable : false,
            sTitle : "文件发布账号",
            sWidth: "9%",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          },
          {
            mData : "buyer",
            bSortable : false,
            sTitle : "购买账号",
            sWidth: "9%",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          },
          {
            mData : "out_trade_no",
            bSortable : false,
            sTitle : "订单号",
            sWidth: "15%",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          },
          {
            mData : "amount",
            bSortable : false,
            sTitle : "产生金额",
            sWidth: "10%",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          },
          {
            mData : "add_time",
            bSortable : true,
            sTitle : "下单时间",
            sWidth: "10%",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          },
          {
            mData : "details",
            bSortable : false,
            sTitle : "描述",
            render : function(value){
              if(value){
                return value;
              }else{
                return "";
              }
            }
          }
        ],
        columnDefs : [
          {
            targets : [0,1,2,3,4,5],
              render : function(value, type, row, meta){
              return pageDataTable.formatColumn(value);
            }
          },
          {
          visible : false,//列的隐藏显示
          targets : []//指定列
          }
        ]
      });
      pageDataTable.buttons(thisTable);
      pageDataTable.action(thisTable);
      pageDataTable.select(thisTable, tableDom);
      pageDataTable.tooltip();
      var thisJquery = $(tableDom).dataTable();
      thisPage = {
        init: function(){
          this.initDom();
          this.addEvent();
        },
        initDom: function(){
          laydate.render({
            elem: '#key_add_time',//指定元素
            format : 'yyyy-MM-dd',/*格式*/
            showBottom : true,/*是否显示底部栏*/
            type: 'date'/*格式,datetime|date|time*/
          });
        },
        createDropdown: function(){
        },
        addEvent: function(){
          this.btnEvent();
        },
        btnEvent: function(){
          $('#btnAdd').on('click', function(){
            thisPage.edit();
          });
          //搜索按钮
          $('#btnSearch').on('click', function(){
            thisPage.search();
          });
          //按钮组-自定义显示列
          $('#iconColumn').parent().parent().on('click', function(){
            pageDataTable.columnCustom(thisTable, tableDom,'#divKeyColumns');
          });
          //按钮组-搜索
          $('#iconRefresh').parent().parent().on('click', function(){
            thisPage.search();
          });
        },
        search: function(){
          if(verifyFn.inputCheck('#orderLog_btn_listData','没有操作权限')) return;
          $(tableDom + '_wrapper table input[type=checkbox]').prop('checked', false);
          thisTable.draw();
        },
        complete: function(data, index, search){
          try{
            if(index){
              layerFn.closeIndex(index);
            }
            if(search){
              thisPage.search();
            }
            if(data){
              layerFn.handleResult(data.msg, data.code);
            }
          }catch(e){}
        }
      };
      thisPage.init();
      $('script').remove();
    });
  });
</script>